package com.glsc.ngateway.platform.repo;

import com.glsc.ngateway.platform.domain.FlowFormDevMember;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Repository
public interface DevMemberRepository extends JpaRepository<FlowFormDevMember, Long>, JpaSpecificationExecutor<FlowFormDevMember> {

    @Transactional
    @Modifying
    @Query(value = "update t_gw_dev_member set deleted = :deleted where relate_id = :processId ", nativeQuery = true)
    void updateByProcessId(String processId, Integer deleted);

    List<FlowFormDevMember> findAllByRelateIdAndDeleted(String processId, Integer noDelete);
}
